package com.ruoyi.appointment.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.appointment.mapper.CarAppointmentMapper;
import com.ruoyi.appointment.domain.CarAppointment;
import com.ruoyi.appointment.service.ICarAppointmentService;

/**
 * 车辆预约Service业务层处理
 * 
 * @author huxiqing
 * @date 2025-04-07
 */
@Service
public class CarAppointmentServiceImpl implements ICarAppointmentService 
{
    @Autowired
    private CarAppointmentMapper carAppointmentMapper;

    /**
     * 查询车辆预约
     * 
     * @param appointmentId 车辆预约主键
     * @return 车辆预约
     */
    @Override
    public CarAppointment selectCarAppointmentByAppointmentId(Long appointmentId)
    {
        return carAppointmentMapper.selectCarAppointmentByAppointmentId(appointmentId);
    }

    /**
     * 查询车辆预约列表
     * 
     * @param carAppointment 车辆预约
     * @return 车辆预约
     */
    @Override
    public List<CarAppointment> selectCarAppointmentList(CarAppointment carAppointment)
    {
        return carAppointmentMapper.selectCarAppointmentList(carAppointment);
    }

    /**
     * 新增车辆预约
     * 
     * @param carAppointment 车辆预约
     * @return 结果
     */
    @Override
    public int insertCarAppointment(CarAppointment carAppointment)
    {
        carAppointment.setCreateTime(DateUtils.getNowDate());
        return carAppointmentMapper.insertCarAppointment(carAppointment);
    }

    /**
     * 修改车辆预约
     * 
     * @param carAppointment 车辆预约
     * @return 结果
     */
    @Override
    public int updateCarAppointment(CarAppointment carAppointment)
    {
        carAppointment.setUpdateTime(DateUtils.getNowDate());
        return carAppointmentMapper.updateCarAppointment(carAppointment);
    }

    /**
     * 批量删除车辆预约
     * 
     * @param appointmentIds 需要删除的车辆预约主键
     * @return 结果
     */
    @Override
    public int deleteCarAppointmentByAppointmentIds(Long[] appointmentIds)
    {
        return carAppointmentMapper.deleteCarAppointmentByAppointmentIds(appointmentIds);
    }

    /**
     * 删除车辆预约信息
     * 
     * @param appointmentId 车辆预约主键
     * @return 结果
     */
    @Override
    public int deleteCarAppointmentByAppointmentId(Long appointmentId)
    {
        return carAppointmentMapper.deleteCarAppointmentByAppointmentId(appointmentId);
    }
}
